import 'package:fake_handwriting/generated/l10n.dart';
import 'package:fake_handwriting/page/main/square_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'mine_page.dart';

class MainPage extends StatefulWidget {
  const MainPage({Key? key}) : super(key: key);
  @override
  State<MainPage> createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
  var _currentIndex = 0;
  var pages = [
    const Square(),
    const Mine(),
  ];
  @override
  Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
        statusBarColor: Colors.transparent,
        statusBarIconBrightness: Brightness.dark));
    return Scaffold(
      body: pages[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        items: [
          BottomNavigationBarItem(
              label: S.of(context).square, icon: const Icon(Icons.label_important_outline_rounded)),
          BottomNavigationBarItem(
              label:S.of(context).profile, icon: const Icon(Icons.account_circle_outlined)),
        ],
        currentIndex: _currentIndex,
        selectedItemColor: Colors.lightBlueAccent,
        unselectedItemColor: Colors.grey,
        type: BottomNavigationBarType.fixed,
        onTap: (i) {
          if (_currentIndex != i) {
            setState(() {
              _currentIndex = i;
            });
          }
        },
      ),
    );
  }
}